object dlgNewDogovor: TdlgNewDogovor
  Left = 836
  Top = 781
  AutoSize = True
  BorderStyle = bsDialog
  Caption = #1057#1086#1079#1076#1072#1085#1080#1077' '#1085#1086#1074#1086#1075#1086' '#1076#1086#1075#1086#1074#1086#1088#1072
  ClientHeight = 181
  ClientWidth = 378
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poMainFormCenter
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object GroupBox1: TGroupBox
    Left = 0
    Top = 0
    Width = 378
    Height = 149
    Align = alTop
    Caption = ' '#1055#1072#1088#1072#1084#1077#1090#1088#1099' '
    TabOrder = 0
    object Label1: TLabel
      Left = 20
      Top = 24
      Width = 130
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1059#1089#1083#1091#1075#1072
    end
    object Label2: TLabel
      Left = 20
      Top = 48
      Width = 130
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1042#1080#1076' '#1091#1089#1083#1091#1075#1080
    end
    object Label3: TLabel
      Left = 20
      Top = 72
      Width = 130
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1055#1086#1089#1090#1072#1074#1097#1080#1082
    end
    object Label4: TLabel
      Left = 20
      Top = 96
      Width = 130
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1046#1080#1083#1080#1097#1085#1072#1103' '#1086#1088#1075#1072#1085#1080#1079#1072#1094#1080#1103
    end
    object Label5: TLabel
      Left = 20
      Top = 120
      Width = 130
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1044#1072#1090#1072' '#1086#1090#1082#1088#1099#1090#1080#1103
    end
    object lcbGroup: TDBLookupComboboxEh
      Left = 158
      Top = 21
      Width = 191
      Height = 19
      AlwaysShowBorder = True
      DropDownBox.Sizable = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'NAME'
      ListSource = dsc_Groups
      TabOrder = 0
      Visible = True
    end
    object lcbService: TDBLookupComboboxEh
      Left = 158
      Top = 45
      Width = 191
      Height = 19
      AlwaysShowBorder = True
      DropDownBox.Sizable = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'NAME'
      ListSource = dsc_Services
      TabOrder = 1
      Visible = True
      OnChange = lcbServiceChange
    end
    object lcbSupplier: TDBLookupComboboxEh
      Left = 158
      Top = 69
      Width = 191
      Height = 19
      AlwaysShowBorder = True
      DropDownBox.Sizable = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'NAME'
      ListSource = dsc_Suppliers
      TabOrder = 2
      Visible = True
      OnChange = lcbServiceChange
    end
    object lcbManager: TDBLookupComboboxEh
      Left = 158
      Top = 93
      Width = 191
      Height = 19
      AlwaysShowBorder = True
      DropDownBox.Sizable = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'MANAG'
      ListSource = dsc_Managers
      TabOrder = 3
      Visible = True
      OnChange = lcbServiceChange
    end
    object dbdeBDate: TDBDateTimeEditEh
      Left = 158
      Top = 117
      Width = 191
      Height = 19
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      Kind = dtkDateEh
      TabOrder = 4
      Visible = True
      OnExit = dbdeBDateExit
    end
  end
  object bCancel: TButton
    Left = 278
    Top = 156
    Width = 99
    Height = 25
    Caption = #1054#1090#1084#1077#1085#1072
    ModalResult = 2
    TabOrder = 2
  end
  object bCreate: TButton
    Left = 174
    Top = 156
    Width = 99
    Height = 25
    Caption = #1057#1086#1079#1076#1072#1090#1100
    Enabled = False
    ModalResult = 1
    TabOrder = 1
    OnClick = bCreateClick
  end
  object ds_Services: TpFIBDataSet
    SelectSQL.Strings = (
      'select s.id, s.name from services s'
      '  where s.group_id = :id'
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    DataSource = dsc_Groups
    Left = 328
    Top = 32
    poSQLINT64ToBCD = True
    WaitEndMasterScroll = True
    dcForceOpen = True
    oFetchAll = True
    object ds_ServicesID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_ServicesNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object ds_Groups: TpFIBDataSet
    SelectSQL.Strings = (
      'select s0.id, s0.name'
      '  from services s0'
      '  where s0.group_id = 0'
      
        '    and not exists(select first(1) 1 from vw_dogovors d, service' +
        's s'
      '          where s.id = d.service_id'
      '            and d.abonent_id = :pabonent_id'
      '            and s.group_id = s0.id)'
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 328
    poSQLINT64ToBCD = True
    oFetchAll = True
    object ds_GroupsID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_GroupsNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object ds_Suppliers: TpFIBDataSet
    SelectSQL.Strings = (
      'select distinct v.id, v.name'
      '  from rtariffs t '
      '  join v_supplier v on v.id = t.supplier_id'
      '  where t.service_id = :id'
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    DataSource = dsc_Services
    Left = 328
    Top = 64
    poSQLINT64ToBCD = True
    WaitEndMasterScroll = True
    dcForceOpen = True
    oFetchAll = True
    object ds_SuppliersID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_SuppliersNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object ds_Managers: TpFIBDataSet
    SelectSQL.Strings = (
      'select r.id, r.manag from rmanag r'
      '  where r.closed_rs = 0'
      '  order by 2')
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    Left = 328
    Top = 96
    poSQLINT64ToBCD = True
    oFetchAll = True
    object ds_ManagersID: TFIBIntegerField
      FieldName = 'ID'
    end
    object ds_ManagersMANAG: TFIBStringField
      FieldName = 'MANAG'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object dsc_Services: TDataSource
    DataSet = ds_Services
    Left = 296
    Top = 32
  end
  object dsc_Groups: TDataSource
    DataSet = ds_Groups
    Left = 296
  end
  object dsc_Suppliers: TDataSource
    DataSet = ds_Suppliers
    Left = 296
    Top = 64
  end
  object dsc_Managers: TDataSource
    DataSet = ds_Managers
    Left = 296
    Top = 96
  end
  object LocalTrans: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 260
    Top = 128
  end
  object q_NewDogovor: TpFIBQuery
    Transaction = LocalTrans
    Database = MAINDM.pMainDatabase
    SQL.Strings = (
      'select dog_id from PROC_NEW_DOGOVOR'
      '   (:PABONENT_ID,'
      '    :PSERVICE_ID,'
      '    :PBDATE,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    null,'
      '    :PSUPPLIER_ID,'
      '    :PMANAG_ID)')
    Left = 296
    Top = 128
  end
end
